package com.jlkf.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jlkf.service.SugFeedbackService;
import com.platform.server.response.response.pojo.ReturnData;

@Controller
@RequestMapping("sugFeedback")
public class SugFeedbackController {

	@Autowired
	private SugFeedbackService sugFeedbackService;
	
	@RequestMapping("getList")
	public Object getList(String startTime,String endTime,Long msgstat,Integer replystat,Integer pageNo,Integer pageSize,Integer orderId){
		return sugFeedbackService.getList(startTime, endTime, msgstat, replystat, pageNo, pageSize,orderId);
	}
	//添加修改
	@RequestMapping("addOrUpdate")
	@ResponseBody
	public Object addOrUpdate(@RequestBody String json){
		return sugFeedbackService.addOrUpdate(json);
	}
	
	@RequestMapping("addOrUpdateClean")
	@ResponseBody
	public Object addOrUpdateClean(@RequestBody String json){
		return sugFeedbackService.addOrUpdateClean(json);
	}
	
	@RequestMapping("getMessageList")
	public Object getMessageList(String startTime,String endTime,Integer pageNo,Integer pageSize){
		return sugFeedbackService.getMessageList(startTime, endTime,  pageNo, pageSize);
	}
	
	/**
	 * 司机的行程反馈  
	 * @param startTime
	 * @param endTime
	 * @param account 反馈的账号
	 * @param replystat
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	@RequestMapping("getDriverList")
	public Object getDriverList(String startTime,String endTime,String  account,Integer msgstat,Integer pageNo,Integer pageSize,Integer orderId){
		return sugFeedbackService.getDriverList(startTime, endTime, account, msgstat, pageNo, pageSize,orderId);
	}
	/**
	 * 用户
	 * @param startTime
	 * @param endTime
	 * @param account
	 * @param msgstat
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	@RequestMapping("getUserList")
	public Object getUserList(String startTime,String endTime,String  account,Integer msgstat,Integer pageNo,Integer pageSize,Integer orderId){
		return sugFeedbackService.getUserList(startTime, endTime, account, msgstat, pageNo, pageSize,orderId);
	}
	/**
	 * 司机行程反馈不扣款处理  更新订单状态为不扣款 处理状态为已处理
	 * @param json
	 * @return
	 */
	@RequestMapping("driverNoDeductions")
	public Object driverNoDeductions(Long id){
		return sugFeedbackService.driverNoDeductions(id);
	}
	
	
	//用户行车反馈
	@RequestMapping("userNorefund")
	public Object userNorefund(Long id){
		return sugFeedbackService.userNorefund(id);
	}
	//扣取用户的清洁费
	@RequestMapping("deductionsUser")
	@ResponseBody
	public Object deductionsUser(@RequestBody String json,HttpSession session){
		try {
			return sugFeedbackService.deductionsUser(json, session);
		} catch (Exception e) {
			e.printStackTrace();
			return new ReturnData(500,"Wow, that's wrong");
		}
	} 
	//用户行程反馈 退款
	@RequestMapping("refund")
	@ResponseBody
	public Object refund(@RequestBody String json,HttpSession session){
		try {
			return sugFeedbackService.refund(json, session);
		} catch (Exception e) {
			e.printStackTrace();
			return new ReturnData(500,"Wow, that's wrong");
		}
	} 
	
	public Object userSugFeedbackRefund(@RequestBody String json){
		return sugFeedbackService.userSugFeedbackRefund(json);
	}
	
	//评论反馈
	@RequestMapping("getComments")
	public Object getComments(String startTime,String endTime,String  telephone,Integer oa_status,Integer pageNo,Integer pageSize){
		return sugFeedbackService.getComments(startTime, endTime, telephone, oa_status, pageNo, pageSize);
	}
	//更新状态
	@RequestMapping("addOrUpdateComments")
	@ResponseBody
	public Object addOrUpdateComments(@RequestBody String json){
		return sugFeedbackService.addOrUpdateComments(json);
	} 
	
	
	@RequestMapping("delComments")
	public Object delComments(Long id){
		return sugFeedbackService.delComments(id);
	}
}
